package com.kzj.laimeimei.recyclerCard.cardView;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.kzj.laimeimei.R;
import com.kzj.laimeimei.recyclerCard.basic.CardItemView;
import com.kzj.laimeimei.recyclerCard.card.other.AddressManagerCard;

/**
 * Created by xyg on 2015/10/26.
 */
public class AddressManagerCardView extends CardItemView<AddressManagerCard> {

    private Context context;
    private ImageView imageView_delete;
    private TextView textView_address;

    public AddressManagerCardView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public AddressManagerCardView(Context context) {
        super(context);
        this.context = context;
    }

    public AddressManagerCardView(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
    }

    @Override
    public void build(final AddressManagerCard card) {
        super.build(card);
        imageView_delete = (ImageView) findViewById(R.id.imageView_delete);
        textView_address = (TextView) findViewById(R.id.textView_address);
//        if (card.isShowDelete()) {
//            imageView_delete.setVisibility(VISIBLE);
//        } else {
//            imageView_delete.setVisibility(GONE);
//        }
        textView_address.setText(card.getAddressBean().getAddress());
        imageView_delete.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                card.getOnNormalButtonPressedListener().onButtonPressedListener(v, card);
            }
        });
        this.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                card.getOnNormalButtonPressedListener().onButtonPressedListener(v, card);
            }
        });
    }
}
